const { src, parallel } = require('gulp');
const stylelint = require('gulp-stylelint');
const eslint = require('gulp-eslint');

function lintStyles() {
    return src(['src/**/*.s[ac]ss'])
    .pipe(stylelint({
        failAfterError: false,
        reportOutputDir: 'reports/lint',
        reporters: [
            {formatter: 'string', save: 'report.txt'}
        ]
    }));
}

function lintScripts() {
    return src(['src/**/*.js'])
        .pipe(eslint({configFile: '.eslintrc.json'}))
        .pipe(eslint.format())
        .pipe(eslint.failAfterError());
}

module.exports.lint = parallel(
    lintStyles,
    lintScripts
)
module.exports.lintStyles = lintStyles;
module.exports.lintScripts = lintScripts;
